<%-- 
    Document   : login_validation
    Created on : 22 May, 2012, 3:33:16 PM
    Author     : bharat
--%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<!--<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>JSP Page</title>
    </head>
    <body>
        
    </body>
</html> -->
<%@page import="java.sql.*" %>

<%

    Class.forName("oracle.jdbc.driver.OracleDriver");
    Connection con = DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:xe", "aksh", "aksh");

    String usr = request.getParameter("usr");
    String pwd = request.getParameter("pwd");

    PreparedStatement pstmt = con.prepareStatement("select *from registered_users_db where usr_name=? and usr_pwd=?");
    pstmt.setString(1, usr);
    pstmt.setString(2, pwd);
    ResultSet rs = pstmt.executeQuery();
    if (rs.next()) {
       // out.println("Welcome " + usr + "<a href=\"two.jsp\">Back to main");
        session.setAttribute("usr", usr);
        response.sendRedirect("myAccount.jsp");
        //out.println("Logged in successfully");
    } else {
        response.sendRedirect("two.jsp");
    }
%>
